package com.asbd.springboot.exception;

import com.asbd.springboot.common.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 功能：自定义的异常
 * 作者：ASBD
 * 日期：2024/12/10 21:59
 */

@ControllerAdvice
public class GlobalException {

    @ExceptionHandler(ServiceException.class)
    @ResponseBody
    public Result serviceException(ServiceException e) {

        return Result.error("500", e.getMessage());
    }
}